<template>
  <div class="app-container" style="padding:0px;">

    <el-row>
      <el-col :span="6">
        <el-card :body-style="{ padding: '2px' }" style="width: 126px;height: 126px;" >
          <img :src="collectPoint.pic" class="image" style="width: 120px;height: 120px;">
        </el-card>
      </el-col>
      <el-col :span="18">
        <el-row>
          <el-col :span="12">
            <div style="padding: 5px;">
              <span>站点名称：{{collectPoint.name}}</span>
            </div>
          </el-col>
          <el-col :span="12">
            <div style="padding: 5px;">
              <span>站点类型：{{pointTypeFormat(collectPoint.pointType)}}</span>
            </div>
          </el-col>
          <el-col :span="12">
            <div style="padding: 5px;">
              <span>站点位置：{{collectPoint.address}}</span>
            </div>
          </el-col>
          <el-col :span="12">
            <div style="padding: 5px;">
              <span>负责人：{{collectPoint.dutyUser}}</span>
            </div>
          </el-col>
          <el-col :span="24">
            <div style="padding: 5px;">
              <span>站点描述：{{collectPoint.remark}}</span>
            </div>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
    <hr>
    <div style="padding: 5px;">
      采集参数时间：{{realDataObj['collecTimes']}}
    </div>
    <el-table v-loading="loading" :data="pointParams" >
      <el-table-column label="参数名称" align="center" prop="paramInfo.name" />
      <el-table-column label="值" align="center" prop="1" >
        <template slot-scope="scope">
          <span v-html="realDataObj[`param${(scope.row.paramId)}`]"></span>
        </template>
      </el-table-column>
      <el-table-column label="单位" align="center" prop="paramInfo.unit" />
    </el-table>
    <hr>
    <div style="padding: 5px;">
      监测设备
    </div>

    <el-table v-loading="loading" :data="pointMeterList" >
      <el-table-column label="仪表名称" align="center" prop="meterInfo.name" />
      <el-table-column label="型号" align="center" prop="meterInfo.model" />
      <el-table-column label="厂家" align="center" prop="meterInfo.factory" />
      <el-table-column label="使用时间" align="center" prop="useTime" />
      <el-table-column label="停止时间" align="center" prop="stopTime" />
    </el-table>

  </div>
</template>

<script>
  import { getCollectPoint } from "@/api/basic/collectPoint";
  import { queryRealData } from "@/api/basic/hisMain";
  import { listPointMeter } from "@/api/basic/pointMeter";

export default {
  name: "DetailConf2",
  props: ["pointId"],
  components: {
  },
  data() {
    return {
      // 字典
      pointTypeOptions: [],
      // 遮罩层
      loading: true,
      // 监测站点参数数据
      collectPoint: {},
      realDataObj:{pointParams:[]},
      pointParams:{},
      pointMeterList:[],
    };
  },
  watch: {
    pointId(){
      this.queryCollectPoint();
      this.getRealData();
      this.getPointMeters();
    }
  },
  created() {
    this.getDicts("basic_point_type").then(response => {
      this.pointTypeOptions = response.data;
    });
    this.queryCollectPoint();
    this.getRealData();
    this.getPointMeters();
  },
  methods: {
    //字典翻译
    pointTypeFormat(pointType) {
      return this.selectDictLabel(this.pointTypeOptions, pointType);
    },
    queryCollectPoint(row) {
      getCollectPoint(this.pointId).then(response => {
        this.collectPoint = response.data;
      });
    },
    getRealData(){
      this.loading=true;
      queryRealData({pointId: this.pointId}).then(response => {
        this.realDataObj = response.data;
        this.pointParams = this.realDataObj.pointParams.filter(v => v.isxx === 'Y')
        this.loading=false;
      });
    },
    getPointMeters() {
      this.loading = true;
      listPointMeter({pageNum: 1, pageSize: 1000,pointId: this.pointId}).then(response => {
        this.pointMeterList = response.rows;
        this.loading = false;
      });
    },
  }
};
</script>
<style lang="scss">
  .treescroll {
    overflow-y: auto;
    height: calc(100vh - 158px);
  }
  .hasTagsView {
    .treescroll{
      height: calc(100vh - 192px);
    }
  }
  .rs{ display: block}
  .rs{padding: 6px 0px 6px 0px}
</style>
